<template>
  <div class="carousel">
    <el-carousel trigger="click" height="460px">
      <el-carousel-item v-for="(item) in bannerList" :key="item.id">
        <img :src="item.imgUrl" alt="">
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import {mapState} from 'vuex'

export default {
  name:"Carousel",
  data(){
    return{
      
    }
  },

  computed: {
    ...mapState({
      bannerList: (state) => state.ModuleHome.bannerList
    })
  },

  // watch: {
  //   bannerList: {
  //     handler: (newValue, oldValue) => {
  //       console.log(newValue, oldValue)
  //     }
  //   }
  // }
}
</script>

<style scoped lang="less">
.el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 150px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
     background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
     background-color: #d3dce6;
  }
  .carousel {
    width: 730px;
    position: relative;
    margin-left: 375px;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
</style>
